.class public abstract Llt/noframe/gpsfarmguide/utils/AsyncCallable;
.super Ljava/lang/Object;
.source "AsyncCallable.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnEndedListener;,
        Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnCancelListener;,
        Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnFinishListener;
    }
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "<T:",
        "Ljava/lang/Object;",
        ">",
        "Ljava/lang/Object;"
    }
.end annotation


# instance fields
.field private cancelListeners:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnCancelListener;",
            ">;"
        }
    .end annotation
.end field

.field private canceled:Z

.field private endedListeners:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnEndedListener;",
            ">;"
        }
    .end annotation
.end field

.field private finishListeners:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnFinishListener;",
            ">;"
        }
    .end annotation
.end field

.field private finished:Z

.field private result:Ljava/lang/Object;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "TT;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>()V
    .locals 1

    .line 6
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 8
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->finishListeners:Ljava/util/List;

    .line 9
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->cancelListeners:Ljava/util/List;

    .line 10
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->endedListeners:Ljava/util/List;

    return-void
.end method


# virtual methods
.method public addOnEndedListener(Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnEndedListener;)V
    .locals 1

    .line 158
    iget-object v0, p0, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->endedListeners:Ljava/util/List;

    invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    return-void
.end method

.method public call()V
    .locals 1

    .line 21
    new-instance v0, Llt/noframe/gpsfarmguide/utils/AsyncCallable$1;

    invoke-direct {v0, p0}, Llt/noframe/gpsfarmguide/utils/AsyncCallable$1;-><init>(Llt/noframe/gpsfarmguide/utils/AsyncCallable;)V

    .line 36
    invoke-virtual {v0}, Ljava/lang/Thread;->start()V

    return-void
.end method

.method public callHere()V
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    .line 45
    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->run()Ljava/lang/Object;

    move-result-object v0

    iput-object v0, p0, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->result:Ljava/lang/Object;

    .line 46
    iget-object v0, p0, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->result:Ljava/lang/Object;

    invoke-virtual {p0, v0}, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->finish(Ljava/lang/Object;)V

    return-void
.end method

.method public cancel()V
    .locals 2

    .line 96
    iget-boolean v0, p0, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->finished:Z

    if-nez v0, :cond_3

    const/4 v0, 0x1

    .line 98
    iput-boolean v0, p0, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->canceled:Z

    .line 99
    iget-object v0, p0, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->cancelListeners:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :cond_0
    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_1

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnCancelListener;

    if-eqz v1, :cond_0

    .line 103
    invoke-interface {v1}, Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnCancelListener;->onCancel()V

    goto :goto_0

    .line 106
    :cond_1
    iget-object v0, p0, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->endedListeners:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :cond_2
    :goto_1
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_3

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnEndedListener;

    if-eqz v1, :cond_2

    .line 110
    invoke-interface {v1}, Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnEndedListener;->onEnded()V

    goto :goto_1

    :cond_3
    return-void
.end method

.method protected finish(Ljava/lang/Object;)V
    .locals 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(TT;)V"
        }
    .end annotation

    .line 71
    iget-boolean v0, p0, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->canceled:Z

    if-nez v0, :cond_3

    const/4 v0, 0x1

    .line 73
    iput-boolean v0, p0, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->finished:Z

    .line 74
    iget-object v0, p0, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->finishListeners:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    :cond_0
    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v1

    if-eqz v1, :cond_1

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnFinishListener;

    if-eqz v1, :cond_0

    .line 78
    invoke-interface {v1, p1}, Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnFinishListener;->onFinish(Ljava/lang/Object;)V

    goto :goto_0

    .line 81
    :cond_1
    iget-object p1, p0, Llt/noframe/gpsfarmguide/utils/AsyncCallable;->endedListeners:Ljava/util/List;

    invoke-interface {p1}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object p1

    :cond_2
    :goto_1
    invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_3

    invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnEndedListener;

    if-eqz v0, :cond_2

    .line 85
    invoke-interface {v0}, Llt/noframe/gpsfarmguide/utils/AsyncCallable$OnEndedListener;->onEnded()V

    goto :goto_1

    :cond_3
    return-void
.end method

.method public abstract run()Ljava/lang/Object;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()TT;"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation
.end method
